package org.example.shop_db.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.shop_db.pojo.Product;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Mapper
public interface ProductMapper {
    //根据产品名字查找产品
    @Select("select * from tb_product where name=#{name}")
    Integer findByName(String name);
    //添加产品

    @Insert("insert into tb_product( name , price, stock,description,total_price)"
        + "values(#{name},#{price},#{stock},#{description},#{totalPrice})")
    void add(Product product);
}
